from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.models.models import Student

# 创建数据库引擎
engine = create_engine('sqlite:///dormitory.db', echo=True)
Session = sessionmaker(bind=engine)
session = Session()

# 查询指定邮箱的学生信息
student = session.query(Student).filter(Student.email == '18702263895@163.com').first()

if student:
    print(f"\n找到学生信息：")
    print(f"学号: {student.student_id}")
    print(f"姓名: {student.name}")
    print(f"邮箱: {student.email}")
    print(f"性别: {student.gender}")
    print(f"年级: {student.grade}")
    print(f"专业: {student.major}")
    print(f"账号状态: {'激活' if student.is_active else '未激活'}")
else:
    print("\n未找到该邮箱的注册信息") 